1. Field of the Invention
The present invention relates to an image processing and an image processing apparatus and particularly to the art of obtaining a dimension, a position, and a rotation angle of an object by processing an image thereof.
2. Related Art Statement
The Applicant of the present application proposed an optical inspecting device in a U.S. patent application Ser. No. 09/317,845. The inspecting device includes an image taking device which takes an image of a portion, or the entirety, of an object to be inspected, and an image processing device which processes the image taken by the image taking device, and inspects the object about whether the object is present or absent, or about a dimension, a position, a rotation angle, etc. of the object. Thus, the inspecting device treats an object to be inspected, as an object to be image-processed, and checks the object about a dimension, a position, a rotation angle, etc. of the object. To this end, the inspecting device superposes a seek template or a measure template on an image of an object, and checks the image about a relative positional relationship between each pair of points of the seek template or each search line of the measure template and an edge of the image.
An edge of an image of an object is a line over which an optical characteristic (e.g., luminance) of the image significantly greatly changes. For example, in the case where the inspecting device processes a silhouette image of an object, the luminance of an inside portion of the image inside an edge thereof is significantly smaller than that of an outside portion of the image outside the edge. Therefore, if the inspecting device recognizes that one of a pair of points of the seek template is located inside the edge and the other point is located outside the edge, the inspecting device judges that that pair of points satisfies a predetermined condition. The seek template includes a plurality of pairs of points pre-set along the edge. If a predetermined number of pairs of points satisfy the predetermined condition, the inspecting device judges that the object being image-processed is an object being sought by the seek template. The measure template includes a plurality of search lines which perpendicularly intersect a plurality of straight portions of the edge, respectively. The inspecting device determines respective actual edge points where the search lines actually intersect the straight portions, respectively, and determines, based on respective relative positions between the respective actual edge points and respective reference edge points predetermined on the search lines, a dimension, a position, and a rotation angle of the object being image-processed. Thus, the inspecting device can easily seek, with the seek template, an image of an object even if the image may possibly take an actual position greatly deviated from its reference position, and can measure, with the measure template, a dimension, a position, a rotation angle, etc. of an image of an object in a short time.
However, the above-indicated image processing device measures a dimension of an image by using a measure template including only a plurality of sets of paired search lines, and measures a rotation angle of an image by using a measure template including only search lines each of which is parallel to either one of two axes of a two-dimensional orthogonal coordinate system or plane. Each set of paired search lines consists of two search lines which are located on a common straight line, have opposite directions, and are paired. The image processing device can process, with those templates, an image having a simple shape such as quadrangle or circle, and an image having such a complex shape that a major or dominant portion of its edge consists of pairs of portions each pair of which are axis-symmetric with each other or consists of straight segments each of which is parallel to either of the two axes of the coordinate system. However, some of the objects to be image-processed do not satisfy those image-shape conditions. Thus, the above-indicated image processing device cannot be sufficiently widely used.
The present invention provides an image processing method and an image processing apparatus which have one or more of the technical features that are described below in respective paragraphs given parenthesized sequential numbers (1) to (14). Any technical feature which includes another technical feature shall do so by referring, at the beginning, to the parenthesized sequential number given to that technical feature. Thus, two or more of the following technical features may be combined, if appropriate. Each technical feature may be accompanied by a supplemental explanation, as needed. However, the following technical features and the appropriate combinations thereof are just examples to which the present invention is by no means limited.
(1) According to a first feature of the present invention, there is provided a method of processing an image of an object to obtain a dimension-difference relating amount which relates to a difference of an actual dimension of the object from a reference dimension thereof, the method comprising the steps of producing a plurality of search lines each of which perpendicularly intersects a corresponding one of a plurality of substantially straight portions of an edge of the image of the object, and obtaining the dimension-difference relating amount based on a sum of a plurality of products each of which is obtained by multiplying a corresponding one of respective edge-point deviations of respective actual edge points where the search lines intersect the straight portions of the edge, respectively, from respective reference edge points on the search lines, in respective directions parallel to the search lines, by a corresponding one of respective parallel-direction distances of the reference edge points from a dimension center of the image of the object in the respective directions parallel to the search lines. The dimension-difference relating amount may be the difference itself of the actual dimension of the object from the reference dimension thereof. However, it may be any other amount, such as a dimension-difference rate which is obtained by dividing the difference by the reference dimension, so long as the other amount corresponds one by one to the above-indicated difference. The dimension center is defined as a point which assures that the sum of the products of the respective edge-point deviations and the respective parallel-direction distances does not change even if the image may be moved by a small distance in any direction or may be rotated by a small angle in any direction. The small distance or the small angle is defined as a distance or an angle which assures that all the search lines continue to intersect perpendicularly the corresponding straight portions of the image, respectively. The present image processing method does not require that the search lines be parallel to the axes of a coordinate plane (e.g., a measure-template coordinate plane) on which the search lines are defined, or that the search lines be prepared as a plurality of sets of paired search lines. Therefore, the present image processing method can determine a dimension-difference relating amount of an image whatever shape its edge may have, i.e., of an image whose edge has any shape other than an axis-symmetric shape or a specific shape a major portion of which consists of straight segments each of which is parallel to either of the two axes of the coordinate plane. Thus, the present method can improve the versatility of a measure template which includes a plurality of search lines and is used to measure a dimension-difference relating amount of an object.
(2) According to a second feature of the present invention that includes the first feature (1), the image processing method further comprises determining, as the dimension center of the image of the object, a point from which a plurality of parallel vectors a sum of which is zero start, extend parallel to the search lines, respectively, and end on respective straight lines which perpendicularly intersect the search lines, respectively, at the respective reference edge points thereof. In this method, the dimension center can be easily determined.
(3) According to a third feature of the present invention that includes the first or second feature (1) or (2), the dimension-difference relating amount comprises a dimension-difference rate which is obtained by dividing the sum of the products by a sum of respective squares of the respective parallel-direction distances. The dimension-difference rate indicates that more distant portions of the image from the dimension center have greater dimension difference amounts. Therefore, the dimension-difference rate can be used to correct more rationally the dimension of the object as compared with a correction amount obtained by simply averaging the respective dimension difference amounts measured on the search lines.
(4) According to a fourth feature of the present invention, there is provided a method of processing an image of an object to obtain a rotation angle (or an angular deviation) of an actual rotation position of the object from a reference rotation position thereof, the method comprising the steps of producing a plurality of search lines each of which perpendicularly intersects a corresponding one of a plurality of substantially straight portions of an edge of the image of the object, and obtaining the rotation angle based on a sum of a plurality of products each of which is obtained by multiplying a corresponding one of respective edge-point deviations of respective actual edge points where the search lines intersect the straight portions of the edge, respectively, from respective reference edge points on the search lines, in respective directions parallel to the search lines, by a corresponding one of respective perpendicular-direction distances of the search lines from a rotation center of the image of the object in respective directions perpendicular to the search lines. The rotation center is defined as a point which assures that the sum of the products of the respective edge-point deviations and the respective perpendicular-direction distances does not change even if the image may be moved by a small distance in any direction. The small distance is defined as a distance which assures that all the search lines continue to intersect perpendicularly the corresponding straight portions of the image, respectively. The present image processing method does not require that the search lines be parallel to the axes of a coordinate plane (e.g., a measure-template coordinate plane) on which the search lines are defined. Therefore, the present image processing method can determine a rotation angle (or an angular deviation) of an image whatever shape its edge may have. Thus, the present method can improve the versatility of a measure template which includes a plurality of search lines and is used to measure a rotation angle of an object.
(5) According to a fifth feature of the present invention that includes the fourth feature (4), the image processing method further comprises determining, as the rotation center of the image of the object, a point from which a plurality of perpendicular vectors a sum of which is zero start, extend perpendicularly to the search lines, respectively, and end on respective straight lines which include the search lines, respectively. In the present method, the rotation center can be easily determined.
(6) According to a sixth feature of the present invention that includes the fourth or fifth feature (4) or (5), the rotation angle is obtained by dividing the sum of the products by a sum of respective squares of the respective perpendicular-direction distances. In the present method, the rotation angle can be easily determined.
(7) According to a seventh feature of the present invention, there is provided a method of processing an image of an object to obtain a dimension-difference relating amount which relates to a difference of an actual dimension of the object from a reference dimension thereof, and obtain a rotation angle of an actual rotation position of the object from a reference rotation position thereof, the method comprising the steps of producing a plurality of search lines each of which perpendicularly intersects a corresponding one of a plurality of substantially straight portions of an edge of the image of the object, obtaining the dimension-difference relating amount based on a sum of a plurality of products each of which is obtained by multiplying a corresponding one of respective edge-point deviations of respective actual edge points where the search lines intersect the straight portions of the edge, respectively, from respective reference edge points on the search lines, in respective directions parallel to the search lines, by a corresponding one of respective parallel-direction distances of the reference edge points from a dimension center of the image of the object in the respective directions parallel to the search lines, and obtaining the rotation angle based on a sum of a plurality of products each of which is obtained by multiplying a corresponding one of the respective edge-point deviations of the respective actual edge points from the respective reference edge points, in the respective directions parallel to the search lines, by a corresponding one of respective perpendicular-direction distances of the search lines from a rotation center of the image of the object in respective directions perpendicular to the search lines. The present image processing method may include at least one of the above-described second, third, fifth, and sixth features (2), (3), (5), (6). The present method can enjoys both the advantages of the method according to the first feature (1) and the advantages of the method according to the fourth feature (4). In addition, since the process needed to obtain the dimension-difference relating amount is largely common to that needed to obtain the rotation angle, the present method can reach the results in a short time.
(8) According to a seventh feature of the present invention that includes the seventh feature (7), the step of obtaining the rotation angle comprises obtaining the rotation angle, using the search lines produced based on the obtained dimension-difference relating amount. In the present method, the possibility of occurrence of failure can be reduced in the step of obtaining the rotation angle.
(9) According to a ninth feature of the present invention, there is provided a method of processing an image of an object to obtain a deviation of an actual position of the object from a reference position thereof, the method comprising the step of obtaining the deviation based on a deviation of an actual dimension center of the image of the object from a reference dimension center thereof. In the case where a designated point designated by an operator or a user as a representative point of the image of the object coincides with the reference dimension center thereof, the deviation of the actual position of the designated point of the image from the reference position thereof is equal to the deviation of the actual dimension center of the image from the reference dimension center thereof. On the other hand, in the case where the designated point is distant from the reference dimension center, the deviation of the actual position of the designated point is determined based on the deviation of the actual dimension center from the reference dimension center and the rotation angle of the actual rotation position of the image from the reference rotation position. Thus, the present method can determine the deviation of the actual position of the object based on the actual dimension center used to obtaining the dimension-difference relating amount of the image.
(10) According to a tenth feature of the present invention, there is provided a method of processing an image of an object to obtain a deviation of an actual position of the object from a reference position thereof, the method comprising the step of obtaining the deviation based on a deviation of an actual rotation center of the image of the object from a reference rotation center thereof. In the case where a designated point designated by an operator or a user as a representative point of the image of the object coincides with the reference rotation center thereof, the deviation of the actual position of the designated point of the image from the reference position thereof is equal to the deviation of the actual rotation center of the image from the reference rotation center thereof. On the other hand, in the case where the designated point is distant from the reference rotation center, the deviation of the actual position of the designated point is determined based on the deviation of the actual rotation center from the reference rotation center and the rotation angle of the actual rotation position of the image from the reference rotation position. Thus, the present method can determine the deviation of the actual position of the object based on the actual rotation center used to obtaining the rotation angle of the image.
(11) According to an eleventh feature of the present invention, there is provided an apparatus for processing an image of an object to obtain a dimension-difference relating amount which relates to a difference of an actual dimension of the object from a reference dimension thereof, the apparatus comprising search-line producing means for producing a plurality of search lines each of which perpendicularly intersects a corresponding one of a plurality of substantially straight portions of an edge of the image of the object; and product-sum obtaining means for obtaining the dimension-difference relating amount based on a sum of a plurality of products each of which is obtained by multiplying a corresponding one of respective edge-point deviations of respective actual edge points where the search lines intersect the straight portions of the edge, respectively, from respective reference edge points on the search lines, in respective directions parallel to the search lines, by a corresponding one of respective parallel-direction distances of the reference edge points from a dimension center of the image of the object in the respective directions parallel to the search lines. The present image processing apparatus may be combined with at least one of the second, third, ninth, and tenth features (2), (3), (9), and (10). The present apparatus may carry out the image processing method according to the first feature (1).
(12) According to a twelfth feature of the present invention, there is provided an apparatus for processing an image of an object to obtain a rotation angle of an actual rotation position of the object from a reference rotation position thereof, the apparatus comprising search-line producing means for producing a plurality of search lines each of which perpendicularly intersects a corresponding one of a plurality of substantially straight portions of an edge of the image of the object; and product-sum obtaining means for obtaining the rotation angle based on a sum of a plurality of products each of which is obtained by multiplying a corresponding one of respective edge-point deviations of respective actual edge points where the search lines intersect the straight portions of the edge, respectively, from respective reference edge points on the search lines, in respective directions parallel to the search lines, by a corresponding one of respective perpendicular-direction distances of the search lines from a rotation center of the image of the object in respective directions perpendicular to the search lines. The present image processing apparatus may be combined with at least one of the fifth, sixth, ninth, and tenth features (5), (6), (9), and (10). The present apparatus may carry out the image processing method according to the fourth feature (4).
(13) According to a thirteenth feature of the present invention, there is provided a recording medium on which an image-processing control program is recorded which is readably by a computer and is usable by the computer to process image data representing an image of an object taken by an image taking device, for obtaining a dimension-difference relating amount which relates to a difference of an actual dimension of the object from a reference dimension thereof, the image data being stored in an image-data memory, the control program comprising the steps of producing a plurality of search lines each of which perpendicularly intersects a corresponding one of a plurality of substantially straight portions of an edge of the image of the object, and obtaining the dimension-difference relating amount based on a sum of a plurality of products each of which is obtained by multiplying a corresponding one of respective edge-point deviations of respective actual edge points where the search lines intersect the straight portions of the edge, respectively, from respective reference edge points on the search lines, in respective directions parallel to the search lines, by a corresponding one of respective parallel-direction distances of the reference edge points from a dimension center of the image of the object in the respective directions parallel to the search lines. The present recording medium may be combined with at least one of the second, third, ninth, and tenth features (2), (3), (9), and (10), and may be used with the image processing apparatus according to the eleventh feature (11) to carry out the image processing method according to the first feature (1).
(14) According to a fourteenth feature of the present invention, there is provided a recording medium on which an image-processing control program is recorded which is readably by a computer and is usable by the computer to process image data representing an image of an object taken by an image taking device, for obtaining a rotation angle of an actual rotation position of the object from a reference rotation position thereof, the image data being stored in an image-data memory, the control program comprising the steps of producing a plurality of search lines each of which perpendicularly intersects a corresponding one of a plurality of substantially straight portions of an edge of the image of the object, and obtaining the rotation angle based on a sum of a plurality of products each of which is obtained by multiplying a corresponding one of respective edge-point deviations of respective actual edge points where the search lines intersect the straight portions of the edge, respectively, from respective reference edge points on the search lines, in respective directions parallel to the search lines, by a corresponding one of respective perpendicular-direction distances of the search lines from a rotation center of the image of the object in respective directions perpendicular to the search lines. The present recording medium may be combined with at least one of the fifth, sixth, ninth, and tenth features (5), (6), (9), and (10), and may be used with the image processing apparatus according to the twelfth feature (12) to carry out the image processing method according to the fourth feature (4).